
function GoodsList(box){
	this.oBox=box;
	this.oImg=$(".gods-img",this.oBox)[0];
	this.price=$(".goods-price",this.oBox)[0];
	this.title=$(".goods-title",this.oBox)[0];
	this.del=$(".goods-del",this.oBox)[0];
	this.gouwuche=$(".icon-gouwuche",this.oBox)[0];
	var _this=this;
	this.gouwuche.onclick=function(){
		_this.pushcar()
	}	
}
GoodsList.prototype.pushcar=function(){
	var code=this.data.goodscode;
	var status=getCookie("status");
	if(status){
		var gouwuche=getCookie(status+"gouwuche");
		if(gouwuche){
			setCookie(status+"gouwuche",gouwuche+"?"+code,3,"/");
		}else{
			setCookie(status+"gouwuche",code,3,"/");
		}
		testgouwuche();
		actionTip("您选的商品已添加进购物车");
		console.log(getGoodsCode())
	}else{
		actionTip("请先登录");
	}
}
GoodsList.prototype.write=function(){
	this.oImg.src=this.data.img;
	this.title.innerHTML=this.data.title;
	this.price.innerHTML=this.data.price;
	this.del.innerHTML=this.data.del;
}

window.onload=function(){
	serach();
	Testsign();//检测登录状态
	actionSerach();//搜索框效果
	actionBrandSeries();//左侧导航效果
	actionKefu();//右侧客服电话效果
	actionScroll();//右侧回到顶部效果
	var goods=$("#goods1")
	var aGoods=$(".one-goods",goods);
	for(var i=0;i<aGoods.length;i++){
		var Box=new GoodsList(aGoods[i]);
		Box.data=data.goods[i];
		Box.write();
	}
	var oMore=$(".more")[0];
	var oPinpai=$(".pinpai")[0];
	var oSp=$("span",oMore)[0];
	var oI=$("i",oMore)[0];
	var oMoreturn=true;
	oMore.onclick=function(){
		if(oMoreturn){
			oPinpai.style.height="126px";
			oI.style.backgroundPositionX="-10px";
			oSp.innerHTML="收起";
		}else{
			oPinpai.style.height="42px";
			oI.style.backgroundPositionX="0px";	
			oSp.innerHTML="更多";
		}
		oMoreturn=!oMoreturn;
	}
	oMore.onmouseover=function(){
		oI.style.backgroundPositionY="-55px";
	}
	oMore.onmouseout=function(){
		oI.style.backgroundPositionY="-46px";
	}
}
